// C++ author 清晨与猫鱼
#include <iostream>
#include <string>
#include "Realize.h"

using namespace std;

/*
\ brief:   打印老板所有员工
\ author: 清晨与猫鱼
*/
void test(Employee& e) {
    
    list<unique_ptr<Employee>>& l = e.getSubordinates();

    if (!l.empty()) {
        for (unique_ptr<Employee>& el : l) {
            test(*el);
        }
    }

    cout << e.toString() << endl;

}


int main(const int argc, const char** argv)
{	
    // 定义一个CEO
	Employee CEO("John","CEO", 30000);

    // 销售主管
    Employee* headSales = new Employee("Robert","Head Sales", 20000);

    // 市场营销负责人
    Employee* headMarketing = new Employee("Michel","Head Marketing", 20000);

    // 办事员1
    Employee* clerk1 = new Employee("Laura","Marketing", 10000);

    // 办事员2
    Employee* clerk2 = new Employee("Bob","Marketing", 10000);

    // 销售代表1
    Employee* salesExecutive1 = new Employee("Richard","Sales", 10000);

    // 销售代表2
    Employee* salesExecutive2 = new Employee("Rob","Sales", 10000);

   // CEO添加销售主管
    CEO.add(headSales);

    // CEO添加营销负责人
    CEO.add(headMarketing);

    // 销售主管添加 销售代表
    headSales->add(salesExecutive1);

    // 销售主管添加 销售代表
    headSales->add(salesExecutive2);

    // 营销负责人添加办事员
    headMarketing->add(clerk1);

     // 营销负责人添加办事员
    headMarketing->add(clerk2);

    // 打印CEO 所有的员工
    test(CEO);
}